package cn.tedu.mm.admin.account.dao.persist.repository.impl;


import cn.hutool.core.bean.BeanUtil;
import cn.tedu.mm.admin.account.dao.persist.mapper.UserMapper;
import cn.tedu.mm.admin.account.dao.persist.repository.UserRepository;
import cn.tedu.mm.admin.account.pojo.entity.UserInfo;
import cn.tedu.mm.admin.account.pojo.param.UserParam;
import cn.tedu.mm.admin.account.pojo.vo.UserStandardVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class UserRepositoryImpl implements UserRepository {

    @Resource
    UserMapper userMapper;

    @Override
    public List<UserStandardVO> userList() {
        return userMapper.userList();
    }

    @Override
    public int updateUser(UserParam userParam) {

        UserInfo userInfo = new UserInfo();
        BeanUtils.copyProperties(userParam,userInfo);
        return userMapper.updateById(userInfo);
    }
}
